package com.fxkj.sthjt.db.controller;

import java.time.LocalDateTime;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fxkj.sthjt.db.entity.JcChannel;
import com.fxkj.sthjt.db.entity.JcChannelExt;
import com.fxkj.sthjt.db.mapper.JcChannelExtMapper;

/**
 * <p>
 * huanbaocms.jc_channel 前端控制器
 * </p>
 *
 * @author 冯晓东
 * @since 2021-09-12 http://localhost:7777/sthjt/jc-channel/repairName
 */
@RestController
@RequestMapping("/jc-channel")
public class JcChannelController {

	@Autowired
	private JcChannelExtMapper jcChannelExtMapper;

	// channel名称修复
	// http://localhost:7777/sthjt/jc-channel/repairName?id=xxx&trsName=xxx
	// http://localhost:7777/sthjt/jc-channel/repairName?id=358&trsName=曝光台_1
	@RequestMapping("/repairName")
	public String repairName(String id, String trsName) {
		JcChannelExt jcChannelExtDb = jcChannelExtMapper.selectById(id);
		jcChannelExtDb.setChannelName(trsName);
		int ok = jcChannelExtMapper.updateById(jcChannelExtDb);

		return "更新条数:" + ok + ":" + LocalDateTime.now();
	}

}
